package com.rulin.asp.sso.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.rulin.asp.sso.entity.User;
import com.rulin.asp.sso.mapper.UserMapper;

@Service
public class UserService {
	
	@Autowired
	private UserMapper userMapper;
	
//	public User getByUserName(String userName){
//		User user = userMapper.selectByUserName(userName);
//		return user;
//	}
	
	public void saveUserSessionId(User user){
		userMapper.updateByPrimaryKey(user);
	}

	public List<User> getAllTeachers(){
		return userMapper.selectAllTeachers();
	}
	
	/**
	 * 根据登录账号获取用户信息
	 * @param userAccount
	 * @return
	 */
	public User getByUserAccount(String userAccount){
		return userMapper.selectByUserAccount(userAccount);
	}
	
	/**
	 * 获取所有用户
	 * @return
	 */
	public List<User> getAllUsers(){
		return userMapper.selectAllUsers();
	}
	
}
